/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.Entity.SIS;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user12
 */
@Entity
@Table(name = "SIS_CALENDAR_ITEMS")
@NamedQueries({
    @NamedQuery(name = "CalendarItems.findAll", query = "SELECT s FROM CalendarItem s"),
    @NamedQuery(name = "CalendarItems.findByItemCode", query = "SELECT s FROM CalendarItem s WHERE s.itemCode = :itemCode"),
    @NamedQuery(name = "CalendarItems.findByItemDesc", query = "SELECT s FROM CalendarItem s WHERE s.itemDesc = :itemDesc"),
    @NamedQuery(name = "CalendarItems.findByItemDescS", query = "SELECT s FROM CalendarItem s WHERE s.itemDescS = :itemDescS")})
public class CalendarItem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ITEM_CODE")
    private Short itemCode;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "ITEM_DESC")
    private String itemDesc;
    @Size(max = 30)
    @Column(name = "ITEM_DESC_S")
    private String itemDescS;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "calendarItem")
    private List<AcademicCalendar> academicCalendarList;

    public CalendarItem() {
    }

    public CalendarItem(Short itemCode) {
        this.itemCode = itemCode;
    }

    public CalendarItem(Short itemCode, String itemDesc) {
        this.itemCode = itemCode;
        this.itemDesc = itemDesc;
    }

    public Short getItemCode() {
        return itemCode;
    }

    public void setItemCode(Short itemCode) {
        this.itemCode = itemCode;
    }

    public String getItemDesc() {
        return itemDesc;
    }

    public void setItemDesc(String itemDesc) {
        this.itemDesc = itemDesc;
    }

    public String getItemDescS() {
        return itemDescS;
    }

    public void setItemDescS(String itemDescS) {
        this.itemDescS = itemDescS;
    }

    public List<AcademicCalendar> getAcademicCalendarList() {
        return academicCalendarList;
    }

    public void setAcademicCalendarList(List<AcademicCalendar> academicCalendarList) {
        this.academicCalendarList = academicCalendarList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemCode != null ? itemCode.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CalendarItem)) {
            return false;
        }
        CalendarItem other = (CalendarItem) object;
        if ((this.itemCode == null && other.itemCode != null) || (this.itemCode != null && !this.itemCode.equals(other.itemCode))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.SisCalendarItems[ itemCode=" + itemCode + " ]";
    }
    
}
